<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
<title></title>
</head>

<body>
<input id="btn" type="button" value="测试" onmousedown="down(event)" onmouseup="up(event)">
<script type="text/javascript">
    function down(event){
        event.target.style.backgroundColor="green";
        event.target.style.color="white";
    }
    function up(event){
        event.target.style.backgroundColor="";
        event.target.style.color="";
    }
</script>
</body>
</html>
